<<<<<<< HEAD
<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2018/8/3
 * Time: 10:12
 */

namespace app\index\model;

class User extends Base
{
    protected $table = 'sy_user';

    public function getMobileAttr($value)
    {
        return str_replace(substr($value, 3,4), '****', $value);
    }

    public function pAgent()
    {
        return $this->belongsTo('User', 'p_id', 'id');
    }

    public function subUsers()
    {
        return $this->hasMany('User', 'p_id');
    }

    public function gAgent()
    {
        return $this->belongsTo('User', 'g_id', 'id');
    }

    public function agent()
    {
        return $this->belongsTo('Agent', 'agent_id', 'id');
    }
}
=======
<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2018/8/3
 * Time: 10:12
 */

namespace app\index\model;

class User extends Base
{
    protected $table = 'sy_user';

    public function getMobileAttr($value)
    {
        return str_replace(substr($value, 3,4), '****', $value);
    }

    public function pAgent()
    {
        return $this->belongsTo('User', 'p_id', 'id');
    }

    public function subUsers()
    {
        return $this->hasMany('User', 'p_id');
    }

    public function gAgent()
    {
        return $this->belongsTo('User', 'g_id', 'id');
    }

    public function agent()
    {
        return $this->belongsTo('Agent', 'agent_id', 'id');
    }
}
>>>>>>> 93c40d8086b7a8d5a9aa3548fdc8eb06a4272cf7
